<template>
	<view class="store_list_box">
		<navBar v-if="isShowCustomNavBar"  :navbarData.sync="navbarData"></navBar>
		<store-list ref="homeParse" :tip="onTip" :apilist="onApiList"></store-list>
    <view class="ios_safe_zone" v-if="isIos">
      <view class="ios_safe_zone_line"></view>
    </view>
	</view>
</template>

<script>
	import api from '@/api/api';
	import tip from '@/utils/tip';
	import NavBar from '@/components/common/navbar';
	export default {
		components: {
			navBar: NavBar,
		},
		data() {
			return {
				navbarData: {
				 showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
				 // navbarTitle: '门店地址',
				 isTopFixed:false,
				 hideSearch: true,
				 hideHome: true,
				},
				isShowCustomNavBar:false,
        isIos: false,
				shareImage: '',
				shareTitle: '',
				pagePath: '',
				pageQuery: '',
				pageCode: "experienceSpace"
			}
		},
		onLoad() {
      this.isIos = 	wx.getSystemInfoSync().system.includes('iOS') && wx.getSystemInfoSync()?.safeArea?.top>20;
			//这里这样写的原因是，不加这个刚跳进来头部图片会先拉长一下
			setTimeout(()=>{
				this.isShowCustomNavBar = true
			},200)
			this.getPageShareData();
		},
		methods: {
			onApiList() {
				return api
			},
			onTip() {
				return tip
			},
			/**
			 * 查询分享数据
			 * @param {Object} option
			 */
			async getPageShareData(option) {
			  try {
			    const res = await this.$commonFunction.getShareinfoByCode(this.pageCode);
			    this.shareImage = res.shareImage || "";
			    this.shareTitle = res.shareTitle || "";
			    this.pagePath = res.pagePath; //  当前页面路由
			    this.pageQuery = res.pageQuery; //  当前页面url参数
			  } catch (e) {}
			},
			onShareAppMessage(res) {
			  let that = this
			  if (res.from === 'button') {} else {
			    this.$EFSTracking.trackingAction('SHARE_CARD', res.from, {});
			  }
			  let imageUrl = this.shareImage;
			  let path = this.pageQuery ? `/${this.pagePath}?${this.pageQuery}` : `/${this.pagePath}`;
			  let title = this.shareTitle ? this.shareTitle : uni.getStorageSync('storeName') || 'THE MACALLAN EBOUTIQUE麦卡伦';
			  this.$commonSensors.sensorsPageShare();
				this.$sr.setContext({ share_title: title });
			  return this.$commonFunction.commonShare(res, title, path, imageUrl);
			},
			onShareTimeline() {
				let title = this.shareTitle ? this.shareTitle : uni.getStorageSync('storeName') || 'THE MACALLAN EBOUTIQUE麦卡伦';
				this.$sr.setContext({ share_title: title });
			  return {
			    title: this.shareTitle ? this.shareTitle : uni.getStorageSync('storeName') || 'THE MACALLAN EBOUTIQUE麦卡伦',
			    query: this.pageQuery,
			    imageUrl: this.shareImage
			  };
			}
		}
	}
</script>

<style>
.store_list_box{
  width: 100%;
  height:100%;
}
</style>
